//用户接口相关的函数
import request from "../utils/request"


//登录函数
//export  暴露出去
export const checkLogin = (data) => {
  return request.post("/users/checkLogin", data)
}


//添加账号
export const usersAdd = (data) => {
  return request.post("/users/add", data)
}

//账号列表
//  原来语法
// export const usersList = (data) => {
//   return request.get("/users/list", {params:data})
// }
export const usersList = (params) => {
  return request.get("/users/list", {params})
}

//编辑账号
export const usersEdit = (data) => {
  return request.post("/users/edit", data)
}


//删除一个账号/users/del
export const usersDel = (params) => {
  return request.get("/users/del", {params})
}


//批量删除
export const batchDel = (data) => {
  return request.post("/users/batchdel", data)
}

//获取账号信息

export const usersInfo = () => {
  return request.get("/users/info")
}

//修改密码
export const usersEditpwd = (data) => {
  return request.post("/users/editpwd", data)
}

//检查原密码是否正确
export const checkOldpwd=(params)=>{
  return request.get("/users/checkoldpwd",{params})
}


//修改用户头像
export const avatarEdit=(params)=>{
  return request.get("/users/avataredit",{params})
}


//暴露第一种方法
export default{
  checkLogin,
  usersAdd,
  usersList,
  usersDel,
  usersEdit,
  batchDel,
  usersInfo,
  avatarEdit,
  usersEditpwd,
  checkOldpwd
}

